<template>
  <div class="rose-echarts">
    <XtEcharts :options="options" height="300px" width="100%" />
  </div>
</template>

<script setup lang="ts">
import XtEcharts from "@/base_ui/echars/src/xtechars.vue"
import { EChartsOption } from "echarts"
import { defineProps, computed } from "vue"
import { IDataType } from "./pie-echart.vue"
const props = defineProps<{
  data: IDataType[]
}>()
const options = computed<EChartsOption>(() => {
  return {
    toolbox: {
      show: true,
      feature: {
        mark: { show: true },
        dataView: { show: true, readOnly: false },
        restore: { show: true },
        saveAsImage: { show: true },
      },
    },
    series: [
      {
        name: "商品分类",
        type: "pie",
        radius: [20, 130],
        center: ["50%", "50%"],
        roseType: "area",
        itemStyle: {
          borderRadius: 8,
        },
        data: props.data,
      },
    ],
  }
})
</script>
<style lang="less" scoped></style>
